<?php
/**
 * The Template for displaying all single posts
 *
 * @package WordPress
 * @subpackage Twenty_Fourteen
 * @since Twenty Fourteen 1.0
 */

get_header(); ?>
<?php do_action( 'wp_script_elevatezoom' ); ?>
<div id="page" class="container">
	<div id="main">
	<div class="breadcrum-wrapper"><div class="col-lg-9"><div class="row"><?php
		the_title( '<div class="entry-header title"><p class="name-crum">', '</p></div><!-- .entry-header -->' );?></div></div><div class="col-lg-3"><?php the_breadcrumb(); ?></div></div>
	<div id="main-content" class="main-content">
		<div class="row main-list-wrapper">
			<div class="col-md-9">
				<div class="row">
				<div class="col-md-5">
					<div class="product_slider"> 
						<?php //do_action( 'lamson_slider_images_product_detail' ); ?>
						<?php  if( class_exists('Dynamic_Featured_Image') ): ?>
							<?php 
							global $dynamic_featured_image;
							$featured_images = $dynamic_featured_image->get_featured_images();
							?>
							<?php if (count($featured_images)): ?>
								<?php foreach ($featured_images as $row=>$innerArray): ?>
									<?php 
									$thumImg = $dynamic_featured_image->get_image_url($featured_images[$row]['attachment_id'],'home-thumnails');
									?>
									<?php if ($thumImg): ?>
									<?php $bigImg = $dynamic_featured_image->get_image_url($featured_images[$row]['attachment_id'],'large'); ?>
									<img src="<?php echo $thumImg; ?>" data-zoom-image="<?php echo $bigImg; ?>">
									
									<?php endif; ?>
								<?php endforeach; ?>
							<?php else: ?>
							<img src="<?php echo get_template_directory_uri().'/images/no_image.jpg'?>" title="no image">
							<?php endif; ?>
						<?php endif; ?>
					</div>
					<ul class="clearfix pagi"></ul>
				</div>
				<div class="col-md-7">
					<div>
					<p>Mã số: <?php the_field('ma_tai_san') ?></p>
					<?php if( get_field( "vi_tri" ) ): ?>
						<p>Vị trí: <?php the_field( "vi_tri" ); ?></p>
					<?php endif;?>
					<?php if( get_field( "dien_tich" ) ): ?>
						<p>Diện tích: <?php the_field( "dien_tich" ); ?></p>
					<?php endif;?>
					<p>Giá khởi điểm: <?php the_field('gia_khoi_điem') ?></p>
					<p>Ngày đăng: <?php the_time('j/n/Y') ?></p>
					<div><span>Chia sẽ bài viết: </span><div class="fb-share-button" data-layout="button_count" data-href="<?php the_permalink();?>"></div></div>
					</div>
				</div>
				</div>
				<?php
					// Start the Loop.
					while ( have_posts() ) : the_post();
						/*
						 * Include the post format-specific template for the content. If you want to
						 * use this in a child theme, then include a file called called content-___.php
						 * (where ___ is the post format) and that will be used instead.
						 */
						get_template_part( 'content', get_post_format() );

						// Previous/next post navigation.
						twentyfourteen_post_nav();

						// If comments are open or we have at least one comment, load up the comment template.
						//if ( comments_open() || get_comments_number() ) {
							//comments_template();
						//}
					endwhile;
				?>
			</div>
			<div class="col-md-3">
				<div class="row">
					<div class="hot-news">
						<a class="arrow-left" href="#"></a> 
						<a class="arrow-right" href="#"></a>
						<div class="swiper-container-hotnews">
							<div class="swiper-wrapper hot-news">
								<?php query_posts(array('post__in'=>get_option('sticky_posts'), 'posts_per_page'=>1)); ?>
								<?php while (have_posts()) : the_post(); ?>
									<div class="new-product swiper-slide"> 
										<?php if ( has_post_thumbnail() ):the_post_thumbnail('home-thumnails'); else: ?>
										<img src="<?php echo get_template_directory_uri().'/images/no_image.jpg'?>" title="no image">
										<?php endif;?>
										<div class="new-product-short">
											<h4><?php the_title() ?></h4>
											<p>Mã số: <?php the_field('ma_tai_san') ?></p>
											<p>Vị trí: <?php the_field('vi_tri') ?></p>
											<p>Diện tích: <?php the_field('dien_tich') ?></p>
											<p>Giá:	<?php the_field('gia_khoi_điem') ?></p>
											<a href="<?php the_permalink(); ?>"><span>Chi tiết</span></a>
										</div>
									</div>
								<?php endwhile; ?>
								<?php wp_reset_query(); ?>
							</div>
						</div>
						<div class="pagination"></div>
					</div>
					<div class="news-wrapper">
						<div class="news">
							<p class="title">Bài Viết Nổi Bật</p>
							<?php echo do_shortcode(' [most_view number="10"]'); ?>
						</div>
					</div>
					<div class="partner-wrapper">
						<?php echo do_shortcode('[rsSlider id="79"]') ?>
					</div>
					<div class="reference-wrapper">
						<div class="reference">
							<p class="title">Liên Kết</p>
							<?php 
								$page_slug ='lien-ket';
								$page_data = get_page_by_path($page_slug);
								$page_id = $page_data->ID;
								echo apply_filters('the_content', $page_data->post_content); 
							?>
						</div>
					</div>
				</div>
			</div>
		</div><!-- #content -->
	</div><!-- #primary -->

<?php
get_footer();
